package org.jradweb.jradtest.service.impl;

import java.util.List;

import org.jradweb.jradtest.dao.UserDao;
import org.jradweb.jradtest.model.User;
import org.jradweb.jradtest.service.UserService;
/**
 * User Service
 *
 * Created On 2008-3-27
 * @author <a href="mailto:wagzhi@gmail.com">Paul Wang</a>
 * @version $Id: UserServiceImpl.java 81 2008-03-28 09:51:50Z wagzhi $
 */
public class UserServiceImpl implements UserService{
	
	private UserDao userDao;
	
	public UserDao getUserDao() {
		return userDao;
	}

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

	public User add(User user) {
		this.userDao.persist(user);
		return user;
	}

	public void delete(User user) {
		this.userDao.delete(user);
	}

	public User get(Integer id) {
		return this.userDao.findById(id);
	}

	public List<User> getAll() {
		return this.userDao.getAll();
	}

	public User update(User user) {
		return this.userDao.merge(user);
	}

}
